#pragma once

#include <AVUIFrameworkElement.h>
#include <AVUIBrush.h>
#include <AVUIPen.h>

namespace AVUI {

class Shape : public FrameworkElement
{
public:
    Shape();

    DECLARE_ELEMENT(Shape, FrameworkElement);

    DECLARE_DEPENDENCY_PROPERTY(Fill);
    TRefCountedPtr<Brush> get_Fill() { return (Brush*)(Object*)GetValue(get_FillProperty()); }
    void set_Fill(Brush* pValue) { SetValue(get_FillProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(Stroke);
    TRefCountedPtr<Brush> get_Stroke() { return (Brush*)(Object*)GetValue(get_StrokeProperty()); }
    void set_Stroke(Brush* pValue) { SetValue(get_StrokeProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(StrokeThickness);
    float get_StrokeThickness() { return AVUI::UnboxValue<float>(GetValue(get_StrokeThicknessProperty())); }
    void set_StrokeThickness(float value) { SetValue(get_StrokeThicknessProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(Stretch);
    Stretch::Enum get_Stretch() { return (Stretch::Enum) AVUI::UnboxValue<int>(GetValue(get_StretchProperty())); }
    void set_Stretch(Stretch::Enum value) { SetValue(get_StretchProperty(), AVUI::BoxValue<int>(value)); } 

    static void OnPenChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);
    static bool IsDoubleFiniteOrNaN(Object* pObject); 
    
protected:

    Pen* GetPen();
    float GetStrokeThickness();

private:
    static void StaticConstructor();

    bool get_IsPenNoOp();

    PenPtr m_pPen;
};

}; // namespace AVUI
